package com.lzy.cloud.producer.controller;

import com.lzy.encrypt.anno.Encrypt;
import com.lzy.framework.core.cache.cluster.RedisClusterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ellengou
 * Date: 2018-03-16
 * Time: PM 4:09
 */
@RestController
public class DcController {

    @Autowired
    DiscoveryClient discoveryClient;

    @Autowired(required = false)
    com.lzy.cloud.producer.remote.TestRemoteApi testRemoteApi;

    @Autowired
    RedisClusterService clusterService;

    @Encrypt
    @GetMapping("/dc")
    public String dc() {
        String services = "Services: " + discoveryClient.getServices();

        discoveryClient.description();
        System.out.println(services);
        return services;
    }

    @PutMapping("/api")
    public String test() {
        return testRemoteApi.api("vavava");
    }

}
